﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using Service.BusinessLayer.Logic;
using Service.BusinessLayer.Entities;
using Service.DataAccess.DataAccessHelper;

namespace Service
{
    /// <summary>
    /// Summary description for WS_NhanVien
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WS_NhanVien : System.Web.Services.WebService
    {
        XL_NhanVien xlnv = new XL_NhanVien();
        [WebMethod]
        public string LayDS()
        {
            string kq = "";
            kq = xlnv.layds_nv().GetXml();
            return kq;
        }
        [WebMethod]
        public void Them(string manv, string honv, string tennv, bool gioitinh, string diachi, string sodienthoai, string chucvu)
        {
            NhanVien nv = new NhanVien(manv, honv,tennv,gioitinh,diachi,sodienthoai,chucvu);
            xlnv.them(nv);
        }
        [WebMethod]
        public void Sua(string manv, string honv, string tennv, bool gioitinh, string diachi, string sodienthoai, string chucvu)
        {
            NhanVien nv = new NhanVien(manv, honv, tennv, gioitinh, diachi, sodienthoai, chucvu);
            xlnv.sua(nv);
        }
        [WebMethod]
        public void Xoa(string manv)
        {
            xlnv.xoa(manv);
        }
        [WebMethod]
        public string SelectSQL(string lenh_sql)
        {
            string kq = "";
            Helper help = new Helper();
            kq = help.SelectQueryByText(lenh_sql).GetXml();
            return kq;
        }
    }
}
